<template>
  <div>
    <div class="header">
      <div>消息</div>
      <div><img src="@/../public/images/1671711500782.png" alt="" /></div>
    </div>
    <van-pull-refresh v-model="isLoading" @refresh="onRefresh">
      <div class="content">
        <div class="first">
          <div class="img-box">
            <img src="@/../public/images/1671711500791.png" alt="" />
          </div>
          <div class="text">
            <div class="my-text">热招新岗位</div>
            <div class="my-text text-sec">19个公司发布了新岗位</div>
          </div>
          <div class="img-right">
            <img src="@/../public/images/1668390326704.png" alt="" />
          </div>
        </div>
        <div class="message">
          <div class="message-item" v-for="messageItem in messageList" :key="messageItem._id" @click.stop="toChatHandler">
            <div class="img-box">
              <img src="@/../public/images/1671711500784.png" alt="" />
            </div>
            <div class="text">
              <div>
                <span>{{messageItem.name}}</span><span class="time">{{messageItem.time}}</span>
              </div>
              <div class="my-text">{{messageItem.text}}</div>
            </div>
          </div>
        </div>
      </div>
    </van-pull-refresh>
  </div>
</template>

<script>
export default {
  name: "MessageView",
  data: () => {
    return {
      isLoading: false,
      messageList:[{
        _id:1,
        name:"微拉智能科技有限公司",
        imgUrl:"@/../public/images/1671711500784.png",
        time:"10:30",
        text:"请问还在考虑新的工作机会吗？"
      },
      {
        _id:2,
        name:"奇趣科技",
        imgUrl:"@/../public/images/1671711500784.png",
        time:"10:30",
        text:"请问还在考虑新的工作机会吗？"
      },
      {
        _id:3,
        name:"北京网络科技查看了您",
        imgUrl:"@/../public/images/1671711500787.png",
        time:"10:30",
        text:"30家公司查看"
      },{
        _id:4,
        name:"北京网络科技有限公司",
        imgUrl:"@/../public/images/1671711500784.png",
        time:"10:30",
        text:"请问还在考虑新的工作机会吗？"
      }],
    }
  },
  methods: {
    //跳转聊天界面
    toChatHandler(){
      this.$router.push("/chat");
    },
    //下拉刷新
    onRefresh() {
      setTimeout(() => {
        this.$toast("刷新成功");
        this.isLoading = false;
      }, 1000);
    },
  },
};
</script>

<style lang="scss" scoped>
.header {
  height: 1rem;
  width: 100%;
  background-color: #149639;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  font-size: 0.48rem;
  padding: 0 0.3rem;
  > div {
    &:nth-child(2) {
      width: 0.38rem;
      height: 0.44rem;
    }
  }
}
.content {
  height: calc(100vh - 2rem);
  overflow: scroll;
  box-sizing: border-box;
  padding: 0.3rem;
  .first {
    width: 6.9rem;
    height: 1.2rem;
    background: #ffffff;
    box-shadow: 0px 0px 0.21rem 0px rgba(1, 64, 153, 0.22);
    border-radius: 0.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0.3rem;
    box-sizing: border-box;
    .img-box {
      width: 0.8rem;
      min-width: 0.8rem;
      height: 0.8rem;
      margin-right: 0.3rem;
    }
    .text {
      text-align: start;
      flex-grow: 1;
      font-size: 0.34rem;
      color: #333333;
      .text-sec {
        font-size: 0.24rem;
        color: #333333;
      }
    }
    .img-right {
      width: 0.15rem;
      height: 0.28rem;
    }
  }
  .message {
    margin-top: 0.2rem;
    .message-item {
      padding: 0.15rem 0;
      width: 100%;
      height: 1.2rem;
      // box-sizing: border-box;
      border-bottom: 1px solid #e5e5e5;
      display: flex;
      align-items: center;
      .img-box {
        width: 0.8rem;
        min-width: 0.8rem;
        height: 0.8rem;
        margin-right: 0.28rem;
      }
      .text {
        width: 100%;
        > div {
          &:nth-child(1) {
            width: 100%;
            font-size: 0.34rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            .time {
              font-size: 0.18rem;
              color: #999999;
            }
          }
          &:nth-child(2) {
            font-size: 0.24rem;
            color: #999999;
            text-align: start;
            margin: 0.12rem 0;
          }
        }
      }
    }
  }
}
</style>